package dm.com.dmexamples;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.Button;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * Created by Damon on 2017/9/20.
 */

public class FrgBaseWeb extends Fragment {


    @BindView(R.id.webview)
    WebView webview;
    @BindView(R.id.button)
    Button button;
    Unbinder unbinder;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.frg_view_web_base, container, false);
        unbinder = ButterKnife.bind(this, view);
        loadData();
        return view;
    }

    private void loadData() {
        String url = "http://datv2.e-baotong.cn:9089/ashx/getexplain.ashx?callback=jQuery20107315307877737869_1508462083455&brand=4646&category=jibinglei&item=2&_=1508462083457";
        webview.loadUrl(url);
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick(R.id.button)
    public void onViewClicked() {
        startActivity(new Intent(getContext(), ActivityFileChooser.class));
    }
}
